home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.programming,comp.lang.c
- Path: lazrus.cca.rockwell.com!news
- From: Erik Vigmostad <ebvigmo@fairfield.com>
- Subject: Re: need help with serial communication using c++
- X-Nntp-Posting-Host: pcff02.cca.rockwell.com
- Content-Type: text/plain; charset=us-ascii
- Message-ID: <3151BF67.5264@fairfield.com>
- Sender: news@lazrus.cca.rockwell.com
- Content-Transfer-Encoding: 7bit
- Organization: Donatech
- References: <DoLBFr.Hvp@seas.ucla.edu> <3150CB28.1CE3@airmail.net>
- Mime-Version: 1.0
- Date: Thu, 21 Mar 1996 20:43:19 GMT
- X-Mailer: Mozilla 2.0 (Win95; I)
-
- Mark Nelson wrote:
- >
- > Daniel D Shin wrote:
- > >
- > > Can someone out there help me how to write serial communication program using c language? Specifically, I need to translate a qbasic
- program into c. The ba
- > >
- > > OPEN "COM1:9600,e,7,1,CS,DS" FOR RANDOM AS #1
- > > PRINT #1, "CH",cn
- > > INPUT #1, dummy
- > > CLOSE #1
- > >
- > > The program must run under DOS environment.
- > > Thank you for your time, and any help would be greatly appreciated.
- > >
- > > shin@seas.ucla.edu
- >
- > Microsoft put serial drivers in their versions of BASIC, which was
- > a nice thing to do. Then, they pretty much left them out of the
- > O/S, which wasn't nice. So you really can't do a direct translation
- > of this QBASIC code into C or C++. (Note: they put the serial drivers
- > into MS Windows, so you can do this translation, sort of. The rest
- > of this message applies to MS-DOS only.)
- >
- > To talk to the serial ports, particularly for input, you are going to
- > need a set of routines that perform interrupt driven communications.
- > You can buy a commercial library, find a shareware library, or just
- > pull some code into your program.
- >
- > If you just want some simple code to add to your program, you can find
- > it accompanying a magazine article on my home page. Follow the links
- > to Articles and look for "Servicing COM Port Interrupts", which ran
- > in 1990.
- >
- > If you want to know more, there is at least one other article on serial
- > communications there. You can also follow the links to my book, "Serial
- > Communications: A C++ Developer's Guide," if you want more depth.
- >
- > Mark Nelson
- > http://web2.airmail.net/marknDownload my shareware program "async30b.zip" from SimTel\msdos\c. If you
- use Microsoft, download async30m.zip. Any questions, call 515-472-7820.
- I include the source and all memory models if you register ($45).
-
- Erik Vigmostad
-